<?php
class Namemanager_Model_Pagedecision implements Namemanager_Model_Mainable{
    
    private $action_handler;
    
    public function main(array $variables = null) {
        switch ($variables['get']['page']){
            case 'wstaw-ustawienia':
                return $this->insert_name_data($variables);
                break;
            case 'aktualizuj-ustawienia':
                return $this->update_name_data($variables);
                break;
            default :
                return $this->default_action($variables);
                break;
        }
    }
    
    private function update_name_data(array $variables = null){
        $this->action_handler = new Namemanager_Model_Updatenamedata;
        return $this->action_handler->main($variables);
    }
    
    private function insert_name_data(array $variables = null){
        $this->action_handler = new Namemanager_Model_Insertnamedata;
        return $this->action_handler->main($variables);
    }
    
    private function default_action(array $variables = null){
        unset($variables['get']);
        $this->action_handler = new Namemanager_Model_Namemanager;
        return $this->action_handler->main($variables);
    }

}
